﻿@model Alma.Models.ProductDetailsModel

@{
    ViewContext.Controller.ViewBag.Breadcrumb.Enter("Mon profil", "Edit", "User", new { id = Session["UserId"] });
    ViewContext.Controller.ViewBag.Breadcrumb.Enter("Edition d'un produit");
}


<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@*<img alt="Product Illustration" class="productImg" src="@Url.Content(Model.ImgUrl)" />
   @using (Html.BeginForm("Upload", "Product", FormMethod.Post, new { @encType = "multipart/form-data" }))
   {
    @FileUpload.GetHtml(initialNumberOfFiles: 1, includeFormTag: false, uploadText: "Upload File")<br />    
     <input type="submit" name="submit" text="upload" />
   }*@
<div class="fullcol">
<h1>Edition d'un produit</h1>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
        @Html.HiddenFor(model => model.ID_Section)
        @Html.HiddenFor(model => model.ID_Shop)
        @Html.HiddenFor(model => model.ID_Cat)
        @Html.HiddenFor(model => model.ID)
        <dl>
        <dt>
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        </dt>
        <dd>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        </dd>
        <dt>
        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        </dt>
        <dd>
        <div class="editor-field">
            @Html.EditorFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>
        </dd>
        <dt>
        <div class="editor-label">
            URL de l'image
        </div>
        </dt>
        <dd>
        <div class="editor-field">
            @Html.EditorFor(model => model.ImgUrl)
            @Html.ValidationMessageFor(model => model.ImgUrl)
        </div>
        </dd>
        <dt>
         <div class="editor-label">
            @Html.LabelFor(model => model.Name_Section)
        </div>
        </dt>
        <dd>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.Name_Section, (ViewData["drop_section"] as SelectList), "select section")
            @Html.ValidationMessageFor(model => model.Name_Section)
        </div>
        </dd>
         <dt>
         <div class="editor-label">
            Disponibilité
        </div>
        </dt>
        <dd>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.AvailabilityName, (ViewData["drop_dispo"] as SelectList))
            @Html.ValidationMessageFor(model => model.AvailabilityName)
        </div>
        </dd>
        </dl>
        <p>
            <input type="submit" value="Sauver" />
        </p>
}
<h2>Critères du produit</h2>
<table>
<tr><th>Nom</th><th>Valeur</th><th>Unité</th><th></th></tr>
@foreach (var crit in Model.CriterionList)
{
    <tr>
    <td>@crit.Item1</td>
    <td>@crit.Item2</td>
    <td>@crit.Item3</td>
    <td>@Html.ActionLink("Editer", "Edit", "ProductCriterion", new { id = Model.ID, idCriterion = crit.Item4 }, null) | @Html.ActionLink("Supprimer", "Delete", "ProductCriterion", new { id = Model.ID, idCriterion = crit.Item4 }, null)</td>
    </tr>
}
</table>
@Html.ActionLink("Ajouter un critère", "Create", "ProductCriterion", new { id = Model.ID }, null)
<div>
    @Html.ActionLink("Retour au profil", "Edit", "User", new { id = Session["UserId"] }, null)
</div>
</div>
